
#bash 
function git_push {
	echo "Hello,设置全局git user信息中"
	git config --global user.email 15860147513@163.com
	git config --global user.name fallingstar
	echo "目前正在工作的目录"
	echo $PWD
	git status
	echo "输入1停止进一步执行，输入2或默认继续执行"
	read stop
	if [ $stop -eq 2 ]; then
		echo "skip this project..."
	else
		echo "写下你的commit信息"
		read message
		echo "选择你要push的分支：2为main、1为master或3为自定义分支"
		read branch
		if [ $branch -eq 2 ]; then
			branch="main"
		elif [ $branch -eq 1 ]; then
			branch="master"
		else
			echo "请输入自定义分支名称"
			read custom_branch
			branch=$custom_branch
		fi
		git add . && git commit -m $message && git push origin $branch
		
	fi
}





for i in $(ls)
do 
	if [[ -d $i ]]
	then
		cd $i 
		git_push
		cd ..
	fi
done


